package cn.darkhorse.workflow.service;

import cn.darkhorse.workflow.auto.entity.ConfirmApproval;
import cn.darkhorse.workflow.auto.entity.ProjectApprovalOpinions;
import cn.darkhorse.workflow.vo.TaskAndUsersVO;
import com.alibaba.fastjson.JSONObject;

import java.util.List;
import java.util.Map;

/**
 * @description:
 * @author: mr.wang
 * @time: 2020/7/3 0003 16:00
 */
public interface IWorkflowToolService {
	
	/**
	 * 选取工作流
	 * @param type
	 * @return
	 */
	List<Map<String,Object>> getWorkflow(String type,String userName);
	
	/**
	 * 发起审批流程
	 * @param businessId
	 * @param workflowId
	 * @param tClazz
	 * @param form
	 * @param type 工作流类型id
	 * @param <T>
	 */
	<T> String startProcessInstance(String businessId, String workflowId, Class<T> tClazz, T form, String type,String userId);
	
	/**
	 * 查询待办事项
	 * @param userName
	 * @return
	 */
	List<Map<String,Object>> getSchedule(String userName);
	/**
	 * 获取审批权限（同意，不同意，否决）
	 * @param taskKey
	 * @return
	 */
	Map<String,Object> getApprovalAuthority(String taskKey,String taskId,String workflowExampleId);
	
	/**
	 * 查询审批表意见
	 * @param businessId
	 * @return
	 */
	List<ProjectApprovalOpinions> getApprovalFormInfo(String businessId,String businessType);

	/**
	 * 之查看本轮
	 * @param businessId
	 * @param businessType
	 * @return
	 */
	List<ProjectApprovalOpinions> getApprovalFormInfo2(String businessId,String businessType);
	
	/**
	 * 确认审批意见
	 * @param confirmApproval
	 * @return
	 */
	Map<String,Object> confirmApproval(ConfirmApproval confirmApproval,String typeB);
	
	/**
	 * 停用未设置交接人的用户
	 * @param workflowExampleId
	 * @return
	 */
	List<TaskAndUsersVO> stopUserNoHandover(String workflowExampleId);
	
	/**
	 * 获取当前流程节点办理人员
	 * @param businessId
	 * @param workflowType
	 * @return
	 */
	JSONObject getNodeHandlers(String businessId, String workflowType,String businessType,String workflowId,String userName,Long projectId);
	JSONObject getNodeHandlersAgree(String taskId,String workFlowId,String businessId,String businessType,String taskKey,Long projectId,String applierName);
	JSONObject getNodeHandlersDisAgree(String taskId,String userName,String remarks,String taskKey);

	/**
	 * 获取当前流程节点任务信息
	 * @param businessId
	 * @param workflowType
	 * @param workflowId
	 * @return
	 */
	JSONObject getNodeHandlersSkip(String businessId, Long workflowType,String workflowId,String bussinessName);

	/**
	 * 获取流程任务图
	 * @param businessId
	 * @param businessType
	 */
	Map<String,Object> getFlowChart(Long businessId, String businessType,String workflowExampleId);
	
	/**
	 * 下一节点办理人
	 * @param workFlowId
	 * @param businessId
	 * @param businessType
	 * @return
	 */
	com.alibaba.fastjson.JSONArray getNextNodeHandlers(String workFlowId,String businessId,String businessType,Long projectId);
	
	/**
	 *获取工作流节点名称
	 * @return
	 */
	String activityIds(String workflowExampleId);
	
	String getCurrentNodeActivity(String workflowId);
	
	/**任务节点通知人员
	 * @param taskKey
	 * @return
	 */
	List<String>  getNotifier(String taskKey);
	
	/**
	 * 设置用户交接流程转办
	 * @param mapList   代办事项
	 * @param handoverPerson  交接用户
	 */
	void setApproveHandover(List<Map<String,Object>> mapList,String userName,String handoverPerson);


	/**
	 * 更新转办记录
	 * @param schedules
	 * @param userName
	 * @param handoverPerson
	 * @param userId
	 * @param transUserId
	 */
	void upTransferHistory(List<Map<String,Object>> schedules,String userName,String handoverPerson,Long userId,Long transUserId);

	/**
	 * 查询转办记录
	 * @param userName
	 * @return
	 */
	Map<String,String> getTransHistory(String userName);
}
